package com.witdata.common.domain.enums.classroom;

import java.util.Arrays;

public enum Term {
    UP(0),
    DOWN(1);

    private int code;

    private Term(int code) {
        this.code = code;
    }

    public int getCode() {
        return code;
        }

    public static Term getTermByCode(int code) {
        return Arrays.stream(Term.values())
            .filter(t -> t.getCode() == code)
            .findFirst()
            .orElse(UP);
    }
}
